import request from '@/config/axios'

export interface UserVO {
  id: number
  avatar: string | undefined
  birthday: number | undefined
  createTime: number | undefined
  loginDate: number | undefined
  loginIp: string
  mark: string
  mobile: string
  name: string | undefined
  nickname: string | undefined
  registerIp: string
  sex: number
  status: number
  areaId: number | undefined
  areaName: string | undefined
  levelName: string | null
  point: number | undefined | null
  totalPoint: number | undefined | null
  experience: number | null | undefined
}

// 查询会员用户列表
export const getUserPage = async (data) => {
  return await request.post({url: `/member/user/page`, data})
}

// 查询会员用户详情
export const getUser = async (id: number) => {
  return await request.get({url: `/member/user/get?id=` + id})
}

// 修改会员用户
export const updateUser = async (data: UserVO) => {
  return await request.put({url: `/member/user/update`, data})
}

// 修改会员用户等级
export const updateUserLevel = async (data: any) => {
  return await request.post({url: `/member/user/dist-agent-upgrade`, data})
}

// 修改会员用户积分
export const updateUserPoint = async (data: any) => {
  return await request.put({url: `/member/user/update-point`, data})
}

// 修改会员用户余额
export const updateUserBalance = async (data: any) => {
  return await request.put({url: `/member/user/update-balance`, data})
}

// 查询父级链
// export const getUserParentInviterChain = async (id: string) => {
//   return await request.get({url: `/member/user/getUserParentInviterChain?id=${id}`})
// }

//获取我的邀请人树结构
export const getUserInviterChainTree = async (id: string) => {
  return await request.get({url: `/member/user/getUserInviterChainTree?id=${id}`})
}

//代理商列表 （分页）
export const agentListPage = async (data: object) => {
  return await request.post({url: `/member/user/agent-page`, data})
}

//佣金来源 （分页）
// export const
// brokerageRecordPage = async (params: any) => {
//   return await request.get({url: `/member/wallet-revenue-source-record/page`, params})
// }
//被邀请人列表 （分页）
export const inviteePage = async (data: any) => {
  return await request.post({url: `/member/user/invitee-page`, data})
}
//被邀请人订单 （分页）
export const inviteOrderPage = async (data: any) => {
  return await request.post({url: `/member/user/invitee-order-page`, data})
}

